package cn.git.bbs.core.service.solr;

import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.beans.factory.annotation.Autowired;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageListener;

public class CustomerListener implements MessageListener{

    @Autowired
    private SearchService searchService;
    public void onMessage(Message message) {
        ActiveMQTextMessage mes = (ActiveMQTextMessage) message;
        try {
            String id = mes.getText();
            searchService.insertProductIntoSolr(Long.parseLong(id));
        } catch (JMSException e) {
            e.printStackTrace();
        }
    }
}
